﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Input;
namespace KinectTD.Input
{
    public static class KeyboardHelper
    {
        private static KeyboardState oldKeyState, newKeyState;

        public static KeyboardState CurrentKeyboardState
        {
            get { return newKeyState; }
        }

        public static bool KeyPressed(Keys key)
        {
            //Check if the key wasn't pressed down in the previous state
            //but now is in the current state
            return (oldKeyState.IsKeyUp(key) && newKeyState.IsKeyDown(key));

        }

        public static void Update()
        {

            //Set the old states to the previous state
            oldKeyState = newKeyState;


            //Get the current state of the keyboard and mouse
            newKeyState = Keyboard.GetState();

        }
    }
}
